package com.mew.chess.core.game.shbz.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;


public enum FishLinkType {

    Prepare(0),  // "准备游戏"),
    Fish(1),   // "正常游戏"),
    Tide1(100),  // "鱼潮阶段"),
    Tide2(101),  // "鱼潮阶段"),
    Tide3(102);  // "鱼潮阶段"),

    private final int code;

    FishLinkType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, FishLinkType> stateMap
            = Arrays.stream(FishLinkType.values()).collect(Collectors.toMap(FishLinkType::code, code -> code));

    public int code() {
        return this.code;
    }


    public static FishLinkType parse(int code) {
        return stateMap.getOrDefault(code, FishLinkType.Prepare);
    }

}
